package com.wu.framework.oauth.api;

import io.swagger.annotations.Api;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * description oauth2 服务权限验证
 *
 * @author 吴佳伟
 * @date 2021/5/25 3:05 下午
 */
@Api(tags = "oauth2 服务权限验证")
@FeignClient(name = "uaa-provider", url = "${feign.url.uaa: }")
public interface OAuth2Api {


    /**
     * description 授权模式
     *
     * @param
     * @return
     * @exception/throws
     * @author 吴佳伟
     * @date 2021/5/27 3:50 下午
     */
    @PostMapping(value = "/oauth/token")
    Object getToken(@RequestHeader("tenantId") String tenantId,
                    @RequestHeader(value = "Authorization") String authorization,
                    @RequestParam("grant_type") String type,
                    @RequestParam("username") String username,
                    @RequestParam("password") String password);


    /**
     * description 密码模式
     *
     * @param
     * @return
     * @exception/throws
     * @author 吴佳伟
     * @date 2021/5/27 3:50 下午
     */
    @PostMapping(value = "/oauth/token")
    Object getToken(
            @RequestHeader("tenantId") String tenantId,
            @RequestParam("grant_type") String type, // password
            @RequestParam("username") String username,
            @RequestParam("password") String password,
            @RequestParam("scope") String scope,
            @RequestParam("client_id") String clientId,
            @RequestParam("client_secret") String clientSecret);

}
